home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutor.exe
/
ANSWERS
/
CH10_1.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-15
|
716b
|
39 lines
#include "stdio.h"
void main()
{
FILE *infile, *outfile, *printer;
char c, infilename[25], outfilename[25];
printf("Enter input file name ----> ");
scanf("%s", infilename);
infile = fopen(infilename, "r");
printf("Enter output file name ---> ");
scanf("%s", outfilename);
outfile = fopen(outfilename, "w");
printer = fopen("PRN", "w");
do {
c = getc(infile);
if (c != EOF) {
putchar(c);
putc(c, outfile);
putc(c, printer);
}
} while (c != EOF);
fclose(printer);
fclose(infile);
fclose(outfile);
}
/* Result of execution
(This program writes to the printer, a file, and the monitor.)
*/